/*
 * @lc app=leetcode.cn id=268 lang=csharp
 *
 * [268] 丢失的数字
 */

// @lc code=start
public class Solution {
    public int MissingNumber(int[] nums) {
        int n = nums.Length;
        int sum = n * (n + 1) / 2;
        foreach (var num in nums)
        {
            sum -= num;
        }
        return sum;
    }
}
// @lc code=end

